import React from 'react'
import { Calendar } from 'antd-mobile'
import { useNavigate } from 'react-router-dom'
function Time() {
    let navigate = useNavigate()
    const toFlight = () => {
        navigate('/FlightHome')
    }
    return (
        <div onClick={toFlight}>
            <Calendar selectionMode='single' renderLabel={(date) => {
                if (date.getMonth() + 1 === 1 && date.getDate() === 1) {
                    // return '圣诞节'
                    return <b style={{ color: 'red' }}>元旦节</b>
                }
                if (date.getMonth() + 1 === 12 && date.getDate() === 30) {
                    return <div style={{
                        width: '10px',
                        height: '10px',
                        backgroundColor: '#f00',
                        borderRadius: '50%'
                    }}></div>
                }
                const now = new Date()
                if (date.getMonth() === now.getMonth() && date.getDate() === now.getDate()) {
                    return '今天'
                }
                const mt = new Date(Date.now() + 24 * 3600 * 1000)
                if (date.getMonth() === mt.getMonth() && date.getDate() === mt.getDate()) {
                    return '明天'
                }
                const ht = new Date(Date.now() + 24 * 3600 * 1000 * 2)
                if (date.getMonth() === ht.getMonth() && date.getDate() === ht.getDate()) {
                    return '后天'
                }
            }} />
        </div>
    )
}

export default Time
